package com.azzcs.juc.demo4;

import java.util.concurrent.*;

/**
 * @Author: wzg
 * @Date: 2021/6/15 上午10:39
 */
public class Main {

    public static void main(String[] args) throws InterruptedException, ExecutionException {
        C1 c1 = new C1();
        FutureTask<String> futureTask = new FutureTask<>(c1);
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.submit(futureTask);
        String result = futureTask.get();
        System.out.println("result:" + result);
        Future<String> submit = executorService.submit(c1);
        result = submit.get();
        System.out.println("result:" + result);
        executorService.shutdown();
    }
}
